const ExecutorClient = require('../ExecutorClient')
const { parentPort } = require('worker_threads')

class WorkerExecutorClient extends ExecutorClient {
    onInit() {
        parentPort.on('message', (...args) => this.on(...args))
    }

    async onSend(msg) {
        parentPort.postMessage(msg)
    }
}

module.exports = WorkerExecutorClient
